<?php

error_reporting(E_ALL);

try {
date_default_timezone_set('Asia/Ho_Chi_Minh');
    /**
     * Read the configuration
     */
    $config = include __DIR__ . "/../app/config/config.php";

    /**
     * Read routers
     */
    include __DIR__ . "/../app/config/routers.php";

    /**
     * Read services
     */
    include __DIR__ . "/../app/config/services.php";

    /**
     * Handle the request
     */
    $application = new \Phalcon\Mvc\Application($di);

    $application->registerModules(
            array(
                'frontend' => array(
                    'className' => 'Frontend\Module',
                    'path' => '../app/frontend/Module.php'
                ),
                'admin' => array(
                    'className' => 'Admin\Module',
                    'path' => '../app/admin/Module.php'
                ),
                'adminlogin' => array(
                    'className' => 'AdminLogin\Module',
                    'path' => '../app/adminlogin/Module.php'
                ),
            )
    );

    echo $application->handle()->getContent();
} catch (\Exception $e) {
    echo $e->getMessage();
    echo nl2br(htmlentities($e->getTraceAsString()));
}
